<?php

namespace Common\Model;

/**
 * AuthorityLabelModel.class实例模型
 * 
 * @author songanwei
 * @date 2016-1-6
 */
class HotelBlackBoardModel extends BaseModel {

    protected $trueTableName = 'tb_hotel_black_board';

    /**
     * 根据客栈id获取内容
     * @modify wenhui 2017-07-28
     * @param int hotelId
     * @return array data
     */
    public function getBlackBoardContent($hotelId) {
    	$option['hotelentity_id'] = $hotelId;

    	$data = $this->where($option)->find();
        return empty($data) ? array() : $data;
    }

    /**
     * 添加内容
     * @modify wenhui 2017-07-28
     * @param int hotelId
     * @return bool
     */
    public function addBlackBoardContent($hotelId, $blackBoardContent) {
    	$data['hotelentity_id'] = $hotelId;
    	$data['content'] = $blackBoardContent;

    	$addResult = $this->add($data);
        return empty($addResult) ? false : $addResult;
    }

     /**
     * 保存内容
     * @modify wenhui 2017-07-28
     * @param int hotelBlackBoardId
     * @return bool
     */
    public function saveBlackBoardContent($hotelBlackBoardId, $blackBoardContent) {
    	$data['id'] = $hotelBlackBoardId;
    	$data['content'] = $blackBoardContent;

        return $this->save($data) === false ? false : true;
    }
}
